package com.seek.springevent.demo.sceneone;

import com.seek.springevent.service.CustomerMobileInfoService;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import java.util.concurrent.ExecutorService;

@Log
@Component
public class ReportProcessor implements ApplicationListener<MobileInfoCallBackEvent> {

    @Autowired
    private CustomerMobileInfoService customerMobileInfoService;

    @Autowired
    private ExecutorService executorService;

    @Override
    public void onApplicationEvent(MobileInfoCallBackEvent mobileInfoCallBackEvent) {
        log.info("======================ReportProcessor==================");
        executorService.execute(()->{
            customerMobileInfoService.processReport(mobileInfoCallBackEvent.getCustomerId(),"15824275713");
        });
    }
}
